Shared naming conventions allow teams to collaborate efficiently.
This rule raises an issue when a function name does not match a provided regular expression.
For example, with the default provided regular expression ^[a-z][a-zA-Z0-9]*$, the function:
function DoSomething(){ // Noncompliant
// ...
}
should be renamed to
function doSomething(){
// ...
}
In case the Drupal framework is detected and the default regex is not replaced, it will follow the PHP coding standards for Drupal.
function doSomething(){ // Noncompliant
// ...
}
should be renamed to
function do_something(){
// ...
}
Exceptions
Methods with an @inheritdoc annotation, as well as magic methods (__construct(), __destruct(),
__call(), __callStatic(), __get(), __set(), __isset(), __unset(),
__sleep(), __wakeup(), __toString(), __invoke(), __set_state(),
__clone(), __debugInfo()) are ignored.
function __construct(){...} // Compliant by exception
function __destruct(){...} // Compliant by exception
/**
* {@inheritdoc}
*/
function myFunc(){...} // Compliant by exception